Repository navigation
feat(results): average, median, range and a promoter score sub type for scale questions - #3984
Open
AndyScherzinger wants to merge 13 commits into
Open
AndyScherzinger wants to merge 13 commits into
AndyScherzinger wants to merge 13 commits into
Conversation
This was referenced Nov 22, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
AndyScherzinger
force-pushed
the
feat/linearscale-promoter-figures
branch
3 times, most recently
from
November 22, 2026 16:52
41d4536 to
bb1c259
Compare
AndyScherzinger
force-pushed
the
feat/linearscale-rating
branch
from
November 22, 2026 17:44
e101909 to
cdb7a45
Compare
AndyScherzinger
force-pushed
the
feat/linearscale-promoter-figures
branch
from
November 22, 2026 17:44
bb1c259 to
6b53b6c
Compare
AndyScherzinger
force-pushed
the
feat/linearscale-rating
branch
from
November 22, 2026 17:47
cdb7a45 to
7e3c30f
Compare
AndyScherzinger
force-pushed
the
feat/linearscale-promoter-figures
branch
from
November 22, 2026 17:47
6b53b6c to
ec657a1
Compare
AndyScherzinger
force-pushed
the
feat/linearscale-rating
branch
from
November 22, 2026 17:53
7e3c30f to
8ecea27
Compare
AndyScherzinger
force-pushed
the
feat/linearscale-promoter-figures
branch
from
November 22, 2026 17:53
ec657a1 to
e7ce346
Compare
A 0-10 scale is not always a "how likely are you to recommend" question, and switching a scale that already has answers to 0-10 would score those answers on the wrong scale. The promoter score is therefore a sub type of the linear scale, fixed when the question is created and stored in extraSettings.questionType next to "Numbers" and "Rating" in the add-question menu. Creating a promoter score question stores the range 0 to 10, the server rejects any other range for it, and the editor shows no range pickers for it. Its lowest and highest values are labelled "Not at all likely" and "Extremely likely" unless the author changes them, as "Strongly disagree" and "Strongly agree" do not fit a likelihood. Existing scales have no sub type and keep working as before. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
…m for scale questions Scale questions only show a bar per value, which makes it hard to compare two questions or two runs of the same form at a glance. The summary now lists the number of answers, the average, the median, the minimum and the maximum above the bars. The median sits next to the average because, at the response counts most forms see, a single extreme answer moves an average a long way. The figures are formatted for the user's locale and are derived from the per-value counts the bars already compute, so the answers are not walked a second time. A rating keeps its own "Average rating" line and gets no figures. No API or schema change; other question types are unaffected. Signed-off-by: global-prog <raqeeb@uosamarra.edu.iq> Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The template comment only restated what the markup next to it shows. Comments in this code base document behaviour, not layout. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The scale figures created their own Intl.NumberFormat per summary, although the module already provides formatCount for the user's locale. As the average is rounded to two decimals before formatting, the output stays the same. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
…alues A rating shows no scale figures, yet their values were collected and sorted first and only then discarded. The sub type is now checked first, using the sub type constant instead of a string literal. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The average of the scale figures showed up to two decimals, while every other average in the results, such as the average rating, shows one. Both now use the same one-decimal formatter. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The figures of a scale (answers, average, median, minimum, maximum) sat in one line with their labels so close to the values that they were hard to read and to tell apart. Each figure is now a small card with the label above a larger value, laid out in a grid that wraps on narrow screens, with more room before the bars. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
A promoter score question splits respondents into promoters (9-10), passives (7-8) and detractors (0-6). The summary of such a question now adds the promoter score, the share of promoters minus the share of detractors, together with both shares. The score is rounded from the exact difference rather than computed from the rounded shares, which can be one point off (4 promoters and 2 detractors out of 7 give 29, not 28). Plain scales, including plain 0-10 scales, show no score. Signed-off-by: global-prog <raqeeb@uosamarra.edu.iq> Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The promoter score compared the sub type with a string literal, while the other sub type checks use the LinearScaleType enum. A typo in the literal would silently hide the score. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The shares of promoters and detractors put a hard-coded "%" after the number, while the per-value bars right below format their shares for the user's locale. In German this showed "50% promoters" above "1 (13 %)". The shares now use the same percent formatter. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Translators need to know that {promoters} and {detractors} already
contain the percent sign. The translation tool only picks up a
TRANSLATORS comment on the line directly above the t() call, which a
template comment never is, so the text moves into a function with the
note above it.
Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The promoter score joins the scale figures as one more card, laid out
like a dashboard figure. The label is just "Promoter score", with the
formula "(promoters − detractors)" kept for screen readers only, so it
no longer wraps. The value shows its sign ("+11", "0", "−25"), as the
score ranges from −100 to 100.
Below the value, one bar split into detractors, passives and promoters
shows the three groups at a glance in red, yellow and green. The bar is
decorative; the line below it states the shares of all three groups,
now including the passives, which were not shown before. The card
takes two grid columns.
Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The figures and the promoter score are computed in the frontend only, which has no unit tests, so end-to-end tests are their only coverage. They check the figures above the bars of a scale question, the promoter score of the promoter sub type, its absence on a plain 0-10 scale, the absence of the figures on a rating, and the questions the add-question menu creates for the "Promoter score" and "Numbers" entries, including the default labels of a promoter score question. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
AndyScherzinger
force-pushed
the
feat/linearscale-rating
branch
from
November 22, 2026 17:56
8ecea27 to
7ac1892
Compare
AndyScherzinger
force-pushed
the
feat/linearscale-promoter-figures
branch
from
November 22, 2026 17:56
e7ce346 to
f710384
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack
Part 2 of 2 of the linear scale stack. Merge in this order:
Replaces #3635, moved from the fork to a branch on nextcloud/forms so CI runs without approval; the commits are unchanged. This PR targets
feat/linearscale-rating. After #3978 is merged, change its base tomainbefore that branch is deleted. CI runs Playwright only for PRs intomain, so the full suite was run locally on the top of the stack: 84 of 84 passed on the final top of the stack (f710384).Screenshots
Summary
Scale questions currently show a bar per value, which makes it hard to compare two questions, or two runs of the same form, at a glance.
This adds a small set of figures, shown as cards above the existing bars, for
linearscalequestions:The median sits next to the average deliberately — at the response counts most forms see, one extreme answer moves an average a long way, and showing both makes that visible.
The promoter score is labelled by its calculation rather than with the name of the method, which is a registered trademark of Bain & Company, NICE Systems and Fred Reichheld.
Scope
questionTypeextra setting, the sub type check on creation, theFormsQuestionSubtypeAPI type and the "Linear scale" sub menu with Numbers) comes from feat(linearscale): rating sub type with stars, hearts or thumbs #3978; this PR adds Promoter score as the third entry, after RatingPOST /api/v3/forms/{formId}/questionsacceptssubtype: promoterforlinearscale;openapi.json,docs/API_v3.mdanddocs/DataStructure.mdare updated. No schema change, no migrationHow to verify
Testing
npm run lintandnpm run build;npm run stylelint, Prettier andvue-tscshow no new findings on the top of the stackFormsServiceTest) and for creating a promoter score question (ApiControllerTest)playwright/e2e/results-scale-figures.spec.tscovers the figures and the score, no score on a plain 0–10 scale, no figures on a rating, and both the "Promoter score" and "Numbers" menu entriesHistory
Based on the work of the original contributor of #3635. The commits that show the scale figures and the promoter score in the results carry their authorship and sign-off; changes made during review are separate commits on top of them. Their original contribution, before the rework: 86a6e87d (average, median, range and promoter score for scale questions).
🤖 AI (if applicable)